<template>
    <div>
        <span v-show="num>0" @click="minus">-</span>
        <span v-show="num>0">{{num}}</span> 
        <span @click="add">+</span>
    </div>
</template>
<script>
export default {
    props:['num','id'],
    methods:{
        add(){
            let num = this.num + 1;
            this.$bus.$emit('add',this.id,num);
        },
        minus(){
            let num = this.num - 1;
            this.$bus.$emit('add',this.id,num); 
        }
    }
}
</script>
